﻿using System;
using GCommon;

namespace COW
{
    public class KLineData : CSVBaseData
    {
        public int index;
        public string date;
        public float open;
        public float high;
        public float low;
        public float close;
        public int volume;

        public override string GetPrimaryKey()
        {
            return date.ToString();
        }

        public override void ParseData(long index, int fieldCount, string[] headers, string[] values)
        {
            index = ReadInt("index", headers, values, 0);
            date = ReadString("trade_date", headers, values, string.Empty);
            open = ReadFloat("open", headers, values, 0);
            high = ReadFloat("high", headers, values, 0);
            low = ReadFloat("low", headers, values, 0);
            close = ReadFloat("close", headers, values, 0);
            volume = ReadInt("volume", headers, values, 0);
        }
    }
}